<?php

namespace Biz\service\advertisement\apiModule;

use Biz\model\advertisement\MCustomCard;
use Biz\model\brand\Brand as mBrand;
use Biz\service\brand\Brand;
use Biz\service\wiki\Wiki;
use Doraemon\model\Member;
use Doraemon\pockets\constInterface\FormatScene;
use Doraemon\pockets\IdSender\IdSender;
use Doraemon\service\Article;
use Doraemon\service\Blank;
use Doraemon\service\Format\Note\HandleNote;
use Doraemon\service\Guide;
use Doraemon\service\Ideabook;
use Doraemon\service\position\PositionConstInterface;
use Doraemon\service\statSign\Basic;
use Doraemon\service\TopicActivity;
use Doraemon\service\User;
use Doraemon\tools\BlockType;
use Doraemon\tools\BlockTypeMapping;
use Doraemon\tools\ImgUrl;
use Hhzbeads\Img\ImageType;

class CustomCard extends BaseModule
{

    const CARD_EXT_TYPE_BANNER = 1;
    const CARD_EXT_TYPE_CONTENT = 3;
    const CARD_EXT_TYPE_SIMILAR = 4;
    const CARD_EXT_TYPE_TOPIC = 5;
    const CARD_EXT_MAP = [
        self::CARD_EXT_TYPE_BANNER => 'Banner',
        self::CARD_EXT_TYPE_CONTENT => '原生内容',
    ];
    const CARD_EXT_MAP_HOME = [
        self::CARD_EXT_TYPE_BANNER => 'Banner',
        self::CARD_EXT_TYPE_CONTENT => '原生内容',
        self::CARD_EXT_TYPE_TOPIC => '主题卡片',
        self::CARD_EXT_TYPE_SIMILAR => '类原生卡片',
    ];
    const FORMAT_HIT = 'formatPosHit';
    private bool $is_home_community_card;
    private bool $is_purchase_card;

    public function __construct($position_id = 0, $userProfile = null)
    {
        parent::__construct($position_id, $userProfile);
        $this->is_home_community_card = $this->position_id == 127;
        $this->is_purchase_card = $this->position_id == 125;
    }
    public function format($hits, $uid, $userProfileExt, $statSignExt)
    {
        $defaultFormatScene = FormatScene::MASONRY_LAYOUTS;
        if ($this->is_home_community_card) $defaultFormatScene = FormatScene::FEED;
        $response = [];
        $statSignParams = [];
        if ($hits) {
            foreach ($hits as $hit) {

                //公共信息赋值
                $index = intval($hit['pos']);
                if ($this->is_purchase_card) {
                    $statSignExt = [
                        Basic::EXTEND_KEY_CONFIG_ID => $hit['id'],
                        Basic::EXTEND_KEY_POS => 'bottom',
                        Basic::EXTEND_KEY_INDEX => $index,
                    ];
                }

                if ($hit['ext_type'] == self::CARD_EXT_TYPE_CONTENT) {
                    list('obj_type' => $type, 'obj_id' => $obj_id) = BlockTypeMapping::getObjFromLinkParams($hit['link_type'], $hit['link_params']);
                    if (!isset($statSignExt)) $statSignExt = [Basic::EXTEND_KEY_OBJ_ID => $obj_id];
                    if ($this->is_home_community_card) {
                        $statSignExt = [
                            Basic::EXTEND_KEY_OBJ_ID => $obj_id,
                            Basic::EXTEND_KEY_RELATE_OBJ_ID => $hit['id'],
                        ];
                        $statSignParams = ['information' => $index];
                    }
                    $tempData = [];
                    if ($this->position_id == PositionConstInterface::CIRCLE_CARD) {
                        $tempData = [
                                'index' => $index,
                                'obj_type' => $type,
                                'obj_id' => $obj_id,
                                'statSign' => $this->statSign($hit, [Basic::EXTEND_KEY_OBJ_ID => $obj_id]),
                            ];
                    } else {
                        switch ($type) {
                            case BlockType::TYPE_PHOTO:
                                $type = BlockType::TYPE_PHOTO;
                                $photo_list = HandleNote::handleNote([$obj_id], $defaultFormatScene, $uid);
                                if ($photo_list && isset($photo_list[$obj_id])) {
                                    $tempData = $photo_list[$obj_id];
                                }
                                break;
                            case BlockType::TYPE_USER_LIST:
                                $userInfo = User::getBasicUserInfo($obj_id);
                                if ($userInfo['type'] == Member::AUTH_USER_BRAND) {
                                    $type = BlockType::TYPE_BRAND;
                                    $brandId = mBrand::getBrandIdByUid($obj_id);
                                    $brandList = Brand::multiFormatBrandCard([$brandId]);
                                    if ($brandList) {
                                        $tempData = [
                                            'brand' => $brandList[$brandId]
                                        ];
                                    }
                                }
                                break;
                            case BlockType::TYPE_WIKI:
                                $type = BlockType::TYPE_WIKI;
                                $wiki_list = Wiki::getWikiList([$obj_id], $uid);
                                if ($wiki_list && isset($wiki_list[$obj_id])) {
                                    if (version_compare(\Doraemon\tools\HhzClient::getClientVersion(), \Doraemon\tools\StatSign::WIKI_UP_GRADE_VERSION_522, ">=")) {
                                        $tempData = [
                                            'wiki' => $wiki_list[$obj_id],
                                        ];
                                    } else {
                                        $tempData = [
                                            'wiki' => ['wiki_info' => $wiki_list[$obj_id]],
                                        ];
                                    }
                                }
                                break;
                            case IdSender::TYPE_WIKI_ALBUM:
                                $album_list = \Biz\service\Album\AlbumListService::getAlbumListByAlbumIds([$obj_id]);
                                $map = [];
                                foreach ($album_list as $info) {
                                    if (isset($info['album_info'])) $map[$info['album_info']['album_id']] = $info;
                                }
                                if (isset($map[$obj_id])) {
                                    $tempData = $map[$obj_id];
                                }
                                break;
                            case BlockType::TYPE_IDEABOOK:
                                $ideaBook = Ideabook::listIdeaBookInfo([$obj_id]);
                                if ($ideaBook && isset($ideaBook[$obj_id])) {
                                    $tempData = [
                                        'folder' => isset($ideaBook[$obj_id]) ? $ideaBook[$obj_id] : []
                                    ];
                                }
                                break;
                            case BlockType::TYPE_TOPIC_ACTIVITY:
                                $topic = TopicActivity::getTopicInfosForList([$obj_id]);
                                $tempData = isset($topic[$obj_id]) ? $topic[$obj_id] : [];
                                break;
                            case IdSender::TYPE_PHOTO:
                                $type = BlockType::TYPE_PHOTO;
                                //$photo_list = Photos::getPhotosForDynamic([$obj_id], $uid);
                                $photo_list = HandleNote::handleNote([$obj_id], HandleNote::WIKI_MASONRY_LAYOUTS, $uid);
                                if ($photo_list && isset($photo_list[$obj_id])) {
                                    $photo = $photo_list[$obj_id]['photo'];
                                    if ($photo['wiki_info']['list'] && is_array($photo['wiki_info']['list'])) {
                                        $photo['wiki_info']['style'] = Wiki::WIKI_STYLE_GOOD_THING;
                                        $photo['wiki_info']['list'] = \Doraemon\tools\StatSign::versionCompatible($photo['wiki_info']['list'], \Doraemon\tools\StatSign::WIKI_UP_GRADE_VERSION_522, BlockType::TYPE_WIKI, 'wiki');
                                    }
                                    $tempData = [
                                        'photo' => $photo,
                                        'action_info' => ['type' => 11, 'addtime' => $photo_list[$obj_id]['photo_info']['addtime']],
                                    ];
                                }
                                break;
                            case IdSender::TYPE_GUIDE:
                                $type = BlockType::TYPE_GUIDE;
                                $guide_list = Guide::getGuidesForDynamic([$obj_id], $uid);
                                if ($guide_list && isset($guide_list[$obj_id])) {
                                    $tempData = [
                                        'guide' => $guide_list[$obj_id],
                                        'action_info' => ['type' => 11, 'addtime' => $guide_list[$obj_id]['guide_info']['addtime']],
                                    ];
                                }
                                break;
                            case IdSender::TYPE_ANSWER:
                                $type = BlockType::TYPE_PHOTO;
                                //$photo_list = Photos::getPhotosForDynamic([$obj_id], $uid);
                                $photo_list = HandleNote::handleNote([$obj_id], HandleNote::WIKI_MASONRY_LAYOUTS, $uid);
                                if ($photo_list && isset($photo_list[$obj_id])) {
                                    $photo = $photo_list[$obj_id]['photo'];
                                    if ($photo['wiki_info']['list'] && is_array($photo['wiki_info']['list'])) {
                                        $photo['wiki_info']['style'] = Wiki::WIKI_STYLE_GOOD_THING;
                                        $photo['wiki_info']['list'] = \Doraemon\tools\StatSign::versionCompatible($photo['wiki_info']['list'], \Doraemon\tools\StatSign::WIKI_UP_GRADE_VERSION_522, BlockType::TYPE_WIKI, 'wiki');
                                    }
                                    $tempData = [
                                        'photo' => $photo,
                                        'action_info' => ['type' => 11, 'addtime' => $photo_list[$obj_id]['photo_info']['addtime']],
                                    ];
                                }
                                break;
                            case IdSender::TYPE_ARTICLE:
                                $type = BlockType::TYPE_ARTICLE;
                                $article_list = Article::getArticlesForDynamic([$obj_id], $uid);
                                if ($article_list && isset($article_list[$obj_id])) {
                                    $tempData = [
                                        'article' => $article_list[$obj_id],
                                        'action_info' => ['type' => 11, 'addtime' => $article_list[$obj_id]['article_info']['addtime']],
                                    ];
                                }
                                break;
                            case IdSender::TYPE_BLANK:
                                $type = BlockType::TYPE_BLANK;
                                $blank_list = Blank::getBlanksForDynamic([$obj_id], $uid);
                                if ($blank_list && isset($blank_list[$obj_id])) {
                                    $tempData = [
                                        'blank' => $blank_list[$obj_id],
                                    ];
                                }
                                break;
                            default:
                                break;
                        }

                        if ($tempData) {
                            $tempData = [
                                    'index' => $index,
                                    'type' => $type,
                                    'obj_id' => $obj_id,
                                    'statSign' => $this->statSign($hit, $statSignExt, $statSignParams),
                                ] + $tempData;
                        }
                    }

                }
                else
                {
                    $link = $this->generateLink($hit['link_type'], $hit['link_params']);
                    $tempData = [
                        'type' => BlockType::TYPE_BANNER,
                        'banner' => [
                            'id' => $hit['id'],
                            'banner' => empty($hit['pic_id']) ? '' : ImgUrl::getUrl(ImgUrl::APPTYPE_OP, $hit['pic_id'], ImgUrl::IMAGE_SIZE_OP_ORI),
                            'link' => $link,
                        ],
                        'statSign' => $this->statSign($hit, $statSignExt),
                        'index' => $index,
                    ];
                }

                if ($tempData) {
                    $response[] = $tempData;
                }
            }
        }


        //按index排序
        if ($response) {
            $sort = array_column($response, 'index');
            array_multisort($sort, SORT_ASC, $response);
        }

        return $response;
    }

    public function formatAdmListExtInfo(&$v, $map)
    {
        switch ($v['ext_type']) {
            case self::CARD_EXT_TYPE_BANNER:
                $v['pic_url'] = empty($v['pic_id']) ? '' : ImgUrl::getUrl(ImageType::APPTYPE_OP, $v['pic_id'], ImageType::IMAGE_SIZE_OP_ORI);
                break;
            case self::CARD_EXT_TYPE_CONTENT:
                list('obj_type' => $v['obj_type'], 'obj_id' => $v['obj_id']) = BlockTypeMapping::getObjFromLinkParams($v['link_type'], $v['link_params']);
                break;
        }
    }

    public function uniquePos($v): string
    {
        return $v['pos'];
    }

    public function formatSimilarCard(MCustomCard $card): array
    {

        $avatar_list = [];
        $hidden = $card->convert ? 0 : 1;
        $desc = '';
        if ($hidden == 0) {
            $member = \Doraemon\model\Member::getUserInfoByIds([$card->convert]);
            foreach ($member as $v) {
                list($avatar,) = \Doraemon\service\User::getUserAvatarPicUrl($v['uid'], $v['avatar_version']);
                $desc = $v['nick'];
                $avatar_list[] = $avatar;
            }
        }
        return [
            'type' => 1054,//类型
            'index' => 0,//序号
            'theme_ranking' => [
                'ranking_link' => $this->generateLink($card->link_type, $card->link_params),//跳转链接,//跳转链接
                'title' => '',//好物榜单类型的ICON
                'margin' => 4,//主副标题间距
                'main_title' => $card->main_title,//主标题
                'main_size' => 14,//主标题字号
                'sub_title' => $card->sub_title,//副标题
                'sub_size' => 12,//副标题字号
                'photo' => $this->generateImgUrl($card->photo),//卡片展示图
                'module_icon' => $this->generateImgUrl($card->module_icon),//模块图标
                'bottom_background_image' => $this->generateImgUrl($card->bottom_background_image),//底部背景图
                'convert_info' => [
                    'hidden' => $hidden,//是否显示转化引导  1隐藏 0显示
                    'avatar_list' => $avatar_list,
                    'desc' => $desc,//用户名称
                ],
            ],
            'statSign' => '',
        ];
    }

    public function formatTopicCard(MCustomCard $card): array
    {
        $hidden = $card->convert ? 0 : 1;
        $avatar_list = [];
        if ($hidden == 0) {
            $avatarUid = $this->staticUid();
            $member = \Doraemon\model\Member::getUserInfoByIds($avatarUid);
            foreach ($member as $v) {
                list($avatar,) = \Doraemon\service\User::getUserAvatarPicUrl($v['uid'], $v['avatar_version']);
                $avatar_list[] = $avatar;
            }
        }
        return [
            'type' => BlockType::TYPE_RECOMMEND_RANKING_CARD,//类型
            'index' => 0,//序号
            'theme_ranking' => [
                'ranking_link' => $this->generateLink($card->link_type, $card->link_params),//跳转链接
                'title' => $this->generateImgUrl($card->module_icon),//好物榜单类型的ICON
                'margin' => 10,//
                'sub_title' => $card->sub_title,//副标题
                'sub_size' => 14,//副标题大小
                'photo' => $this->generateImgUrl($card->photo),//副标题背景
                'convert_info' => [
                    'hidden' => $hidden,//是否显示转化引导  1隐藏 0显示
                    'avatar_list' => $avatar_list,
                    'desc' => "大家都在看"
                ],
            ],
            'statSign' => '',
        ];
    }

    public function staticUid($count = 3): array
    {
        $uid = [13628055,6291056,919525,282732,4854522,2442636,1244474,1208704,5180943,139258,76631,175144,1457173,9424505,58838,288422,14656647,1797773,408037,486910,30745,28735,68439,12345475,9930253,11796314,11323805,205078,141293,87683,2199446,9662929,9961865,10885553,1805281,4635738,60310,14588417,9725365,42228,1740139,559851,13133645,15890,199526,14627,36871,2190627,11745819,135233,878049,14868127,1290743,33043,2641082,10810235,109981,199126,849928,9385991,1263330,62300,14202638,2532129,2791045,2768693,9731213,1683865,12010,52321,210286,8772815,1315131,3959959,993255,8963451,5369907,530550,9114289,1142338,9331436,26956,840447,1307649,12732116,8772081,5624633,359777,237612,214205,4411505,206967,1317301,39446,705303,592602,4993567,61895,1702026,12877408,11522906,13551278,14281331,4602447,625451,728573,6854930,2689618,63850,8737584,17193,55817,1064492,14527219,1145206,1000842,35927,41420,14263745,12794896,358731,6887963,1846658,14158711,1029781,5284812,138888,11092131,5183272,3712681,11788783,432237,8478350,13368106,29428,8525061,1987741,2590710,10139801,23496,3389695,12161743,2541904,298522,6612443,1307488,14884347,63193,2384981,342955,401294,13034032,6428900,472823,4507586,1112980,662818,14604721,8886823,9886194,14055499,406988,3796952,4376867,3122719,273104,5327598,12110616,5381929,25326,14341903,128114,10770558,1297783,3312783,817154,77917,648405,111766,6000548,4715572,9319378,84032,1501135,323388,2156688,128574,1705449,841220,1772494,14478020,11118952,11235167,1134323,14050880,5524210,4636021,12337581,69841,18808,1225389,3747205,4429738,13946935,23448,377539,8441112,13538001,56543,613319,2854722,1477055,14083238,1336418,12915535,30853,2271020,1129352,2028100,8344880,429826,865950,14695291,11603069,4336712,12882731,12477087,2450231,11219087,681193,5080931,564698,1740474,26290,422162,14176608,14857423,14834712,27775,6045887,11184847,60767,54497,3868042,5187710,1277803,6281090,3121977,290448,5421529,1440749,10986618,12440,9054711,28086,766388,2208365,207550,9474520,1378405,2766202,1550600,57772,11189346,288908,12171553,11414777,11185827,2624611,52505,1788061,6771357,11738630,560590,1044253,1624439,287516,6447551,14167760,579292,849067,2973811,14055568,1024257,2668564,44472,14246456,450534,2883501,3651838,9630978,10126573,5129541,446176,16816,2967287,13039674,2783487,1613864,9374938,5915412,5266842,7328528,6860460,1132503,1201641,10318173,8995207,5386220,719325,8716096,520371,2193410,6613402,5440193,14868609,2239646,448967,12685808,7983121,1223615,697010,4586397,3335730,11914,9965772,8144540,14109055,370363,1762592,210029,11728059,1262866,1461320,123493,536521,2801916,19614,11598331,3627872,515099,14048,13287003,425165,2706197,1026845,14371001,7847170,3239864,8360931,14380721,135841,1322357,1278117,3436054,607164,308286,46255,14891915,9097728,543863,77841,556934,8790255,4908659,10316120,667898,1241936,13562155,10028069,23025,4407269,721261,384833,14364300,14220162,2283511,1771107,6461438,285082,446048,2254872,11570071,6801227,7772475,11284699,14478948,3954586,10774279,1568079,389700,5295316,60147,1808181,13463,87708,2047112,14254609,13730736,136817,118063,4744827,30131,14421427,37671,45991,12105780,11818804,7086350,1073452,14050940,1327084,1076044,4443845,5268963,13724593,1795167,2593988,7351482,14532906,9218078,3189575,2319825,55333,14829082,5510116,12142851,2768368,14380159,5369838,744575,14919288,2237966,13606614,9672637,4297833,5043663,527287,11607559,575354,14412923,67668,864424,43378,458975,2756999,7318417,39026,553544,1131633,12165560,13315190,591651,3537004,153945,2631349,9286263,7599616,559360,1281349,3619000,11562613,1909802,8566164,2039762,1373920,4366536,14018646,3287959,1375169,383602,538632,2832809,305519,14399832,1322537,14936615,3345683,7156830,8462068,1181851,121339,191844,5670332,14370305,4162593,6750955,4781054,53281,2490331,8709199,394330,10514888,296074,381994,398717,9302021,3404596,1687868,38321,10740403,2830204,1477431,12458964,314489,181719,5444425,13153421,1857022,3925664,9099228,1570546,2131203,257140,99446,2764882,1842406,14406163,222581,14920258,11590785,14362525,994531,12173742,3190689,137186,7046201,1065531,1668040,14680724,3982978,10153865,2733049,11926942,12618416,5423084,3728729,9575382,1972559,3376257,7238619,12539123,2290462,5454903,436319,13919262,1234529,1264992,2130742,5813594,1316458,6321458,9698782,278014,11787333,131708,3665116,1975317,224395,14710571,51800,2138445,136732,2111018,522922,1092559,1899867,51620,251962,1201196,5010758,2734280,22404,2757498,1297435,11309273,363240,2451964,2166500,9586163,290680,5774620,5878240,2575543,48386,57238,722127,329989,2242795,8556471,8137748,125788,2725231,101435,630180,149814,4458902,12369743,814584,2272580,9726821,13864744,5298304,1020783,2073118,375394,257085,681034,50713,139571,12952,125112,3877480,13231717,241773,14942662,5393542,748799,14845896,231077,411617,1110221,2412455,6987766,14821224,222112,7960980,6123739,24615,78217,126885,722822,9883484,12176648,435209,1832775,10886137,3949326,10638390,802862,2942231,9079046,12145,5376813,11012099,1140185,43355,297260,46428,8742990,26878,14834224,1110612,1508480,14799038,14406314,8030783,8920520,3280401,7401025,899972,3152596,13168888,14152452,2756713,1097142,1746791,27614,244029,8109279,59813,3810727,37722,12657501,51155,3087228,154101,139340,1517737,81713,14604628,1251066,14715985,11741166,8331372,954573,14527652,995892,75832,3745978,104000,985613,9736209,2361688,9951895,10213028,355690,14328549,11287843,2013002,2658497,842185,13961,10981035,529224,5469045,14799049,14357212,5541625,4945241,17206,13590728,14649776,347822,5313675,2057507,14154064,1137072,2749451,2927902,89255,24281,1231730,9915700,514880,13099973,2082605,12852354,23235,1642704,2604799,10372393,14887614,9487344,5786467,414045,19251,870724,230258,13968955,7492979,1119124,12905604,14424538,110865,765401,2668131,8509442,11916347,763555,1046230,5241742,11850269,522023,6229052,2245950,153007,14143180,11843350,475979,844941,119629,7007933,921022,14857106,5628198,2792662,878187,382402,119409,724805,143677,391948,10509250,13263969,1476355,692046,3769056,25977,10579246,4820421,3200258,849810,188173,9378282,1826893,5584962,14355943,14535482,4334544,19295,1755474,4688004,1835851,10627849,9138676,11978973,14891302,1092679,2591481,1711849,13968154,79867,784234,9254214,1610059,13494881,3733544,57440,1198063,10801865,2652798,6128094,1063489,738364,11834574,1518897,1140716,8243547,14416,6702278,530766,1489420,422384,2350776,1081119,293257,9740745,3823573,125726,6509941,13545505,58762,1579528,26566,2593250,2118618,1617564,5491480,438548,794675,12315865,12097279,12932970,33753,393956,6642177,527330,2382126,1589857,14628820,5870409,459330,8978966,9030622,885607,1945475,270361,9760910,8510755,8535054,13250059,7698270,2995518,14414069,27995,14904743,2886242,51918,128877,321991,5717825,1144893,12328462,1099804,416785,177625,871576,610390,2596751,13746616,13919562,7518803,10677073,6846376,4907987,8545227,4089237,684836,7398157,11434382,12100259,9835436,101520,240262,3550169,3554187,14704347,14247355,18570,10105094,9325206,4426567,14110804,2086742,2831760,216012,13366378,758181,1833714,5876467,362524,1018336,11883790,258461,7809232,5172397,1921679,10253195,8017511,5949197,7370898,10837490,1484758,821904,5793018,14467342,222628,3588015,2320654,97529,5187142,519902,5043161,12068383,10099180,2677250,14147632,12379866,152981,165171,12011132,5958689,78247,2800712,12491874,850527,12450731,4313781,2666098,2606027,2606508,702416,10455425,174031,8425635,1656089,1525894,7861247,1218265,10792040,14338988,541959,763843,10336477,2290106,25336,3383926,686243,764756,6097690,291470,5774291,14370450,502526,14864504,4657033,3015627,4152092,14194072,22576,105514,427210,14890467,4366595,4886574,77818,1977997,56866,5334909,414627,12379,2425894,6748035,6434979,11832338,3035887,31309,14917871,4602666,2362056,1817835,6837072,9948783,154375,13669311,7814592,113036,2085682,399439,4555323,12604227,4788948,14757999,8628726,9571313,11208018,14252803,50814,13277983,14914479,5567727,1491316,9270663,2114119,10906878,8588607,60234,2372073,11858572,14160791,13404749,14239521,14217,1682725,4239825,13274,8980329,377195,338379,50989,11287290,189418,5445162,2440060,44182,34924,326315,1464328,2745480,1404518,21419,14752,12154374,1693981,14614752,457193,671285,1294129,279949,342461,4326944,54588,12294351,11094429,99884,223361,12078209,9470904,4311689,344403,833471,247379,5116198,28849,8853103,3621744,2524783,13754453,13918826,353235,11622131,8643887,3199478,1834457,11134265,9811514,902280,13737,960316,9053077,1843344,14530988,11179235,748544,12258048,2515152,63780,128982,12826080,1155546,6286955,1179911,105175,455835,2346176,14518913,804287,14500164,14398562,1208268,13092878,41013,813518,7571664,2823750,3792037,5438916,39465,6143197,5846746,12300979,10493549,10173711,42815,1229647,405353,931783,11604286,3820773,243961,9146102,367541,9175967,4763379,6164933,546166,9736685,3425569,320835,1058489,2863445,10040014,782746,8714041,9727708,27927,5834962,8399622,531132,2694215,111238,337227,738707,1554233,4316272,3686832,11191858,13221367,417344,12104216,927942,185271,14308293,10662661,148039,169451,2075951,8243054,1769711,3186011,5815003,1196212,1227795,2661043,2006937,11202166,14749262,3030561,11509439,1114058,261006,756756,12035,12608809,10551095,40910,10216415,12334478,3536929,138932,822287,11431607,10273879,3232562,135286,14526310,1202075,2798167,2648734,374662,68030,1452204,12582713,6852691,778673,79709,10161621,187739,11164935,6203739,11902,279145,458727,7751685,4524498,11558136,1725007,2079823,5295384,6379588,8958987,94333,9547884,428098,13658,7140429,2289460,2552342,1048712,11908127,1644169,1059084,11058950,958501,10123918,270762,89525,51237,13862,1682269,119533,5876726,1718335,5560388,177618,6831835,13085366,1505229,216530,13920466,38849,261561,294313,6365444,3586715,12047498,27020,2798679,144533,5636178,10561125,5936336,2046315,112502,9532519,12782,28481,2522380,12538575,2918091,10504948,5900467,10503165,14557953,10503288,446695,8922913,1040279,555684,11534534,6377581,12425883,339883,4769046,591040,534646,14245387,134354,12768512,28621,60709,1169032,14367399,5237621,11626511,266805,4054362,195371,309286,1015527,8463778,649299,2733775,4612532,5984545,33726,659494,3482276,14652162,7389949,4483901,12047491,14343401,5053043,4740312,40731,1777845,1702358,13611043,1129157,5724615,9203406,2171079,3779018,8579664,13197755,566110,20416,28680,5342376,13245492,9373115,981935,35508,737600,9753268,838938,91253,10550302,4431757,11332247,414904,86863,5915238,4932822,11139822,13607328,13231073,5590283,1565382,14871534,77708,14573441,767849,2301533,4628446,12178793,4817722,13396185,25949,2675033,11297871,3903523,33966,873294,151922,71411,9605774,7248954,8478084,130356,50557,8427009,2336331,138866,11827565,92031,4289983,35616,9049425,11763081,433345,1018017,11061790,10486758,8530260,9439674,24857,2905877,1128878,58611,3875022,1418003,38711,11826607,4659580,116222,1939738,3116435,5374142,6466533,12324390,188127,12550485,4232844,396985,450381,4781842,6465212,586371,1192990,8001247,11834771,4966369,13657147,8206061,142508,249739,57736,117567,10680556,5204625,531708,10753198,11850383,1149186,6479925,12195668,8947452,6114401,20965,8285772,5335355,757125,5401154,882373,6185931,774754,971825,108137,10462117,4604067,5257274,222787,1713419,8661554,609035,9920898,1563120,13597153,533984,6691654,392196,2860043,3176113,13792495,1050017,2798984,651299,12109435,9111042,412264,6057231,213596,12854209,8993767,5789934,5285410,40853,51644,1049041,40072,84166,1724327,70023,1776008,13224169,3240262,5278886,1162417,100376,7854514,5696446,240877,3522179,10605380,1264920,5583476,7977918,8551918,821163,3411618,12414200,8888726,12501,8032667,101276,6950794,802631,7310267,1199048,10045771,12238807,3045308,5265646,53351,276409,8993117,534901,2140372,818218,703657,1037847,1560081,12745412,2437634,2176738,1536631,3121810,963084,13708672,2769207,2024675,10953609,34763,11660014,8808080,127988,11285210,389403,2554317,8155927,30953,5819188,283369,1111545,8198398,14344902,17296,6858546,9875401,1341018,572600,13516,4093767,3008755,11050282,391369,2465599,12394547,11527474,8654534,262052,30856,635623,24912,357230,6685738,1697396,7560352,8658687,5608473,14512847,2584675,3251459,71607,3101887,1319213,13307290,481812,4342163,12156268,4210045,1440511,957202,3862437,10090175,3748642,3465161,37948,13322184,298836,10368749,14536444,10311652,10884453,349847,135178,9192618,272829,10445506,10911794,13528046,13068787,5377745,105915,648411,1842921,24497,420196,1251464,274789,9758147,5358410,50720,66769,13648673,8776402,8897578,11850806,12021,9724048,44454,519286,13217716,5385319,663183,13017915,14317429,7817748,1053455,14413907,12065349,1870576,5506807,27087,6333316,1003085,1529351,209140,11305447,33857,5870919,8237883,965233,62280,9276146,679481,199905,943978,11631494,9022718,9829554,6427030,1356342,652564,8890080,197697,10485379,830843,13333,13890,12091797,9091468,12619704,12541615,1279890,78606,2800485,849938,378236,9505903,2125284,1301652,21375,4381297,635154,35431,5481709,141149,2508216,1287164,2901434,2505225,9902649,1026914,11318193,1503392,454998,184404,4527899,1865597,144629,32920,13091272,1321859,12446075,4508882,7907003,433202,8561669,5426643,84081,2281697,523067,3041546,2334869,2721112,225925,1680121,8358912,9412640,4866639,1300885,6027953,1151313,1699898,11910627,266634,8416260,1704420,4914524,7672158,571335,14306973,93219,34967,1108376,9471371,10390886,3297026,5608469,10009046,1690056,260887,1514633,8421409,8905848,3882737,1606065,9466794,4970352,10795287,2537919,12158149,30029,3359680,4405276,23696,2238778,11694062,730438,1302372,386119,4833359,3589600,3894610,14656517,355062,7519760,14492065,2758607,14396376,1581377,14465418,11536052,1215934,9405698,10746180,42455,13031566,9412678,6939276,1233614,13735270,240352,2816389,14342646,7358632,50395,13474829,738703,5247839,5181136,378468,641386,3274553,743671,6816909,323459,14342544,520693,764484,7768217,14144327,2277665,12235619,14873232,5584782,5972506,209340,1051074,1293645,12917925,12228284,7512559,966524,14354830,937988,1140035,9163642,7033926,612409,231956,1894398,5579629,7719222,3522652,5561350,1698677,13727381,1227887,8570548,12192266,7474767,14261542,7068103,11667179,10493398,3095615,11906,666492,14694,12178960,11181120,147218,10662884,1178588,12024,5533004,11479553,11020945,7280492,52730,2120853,14557247,8465268,3111392,10199960,137436,2222849,5830032,5608575,268544,317085,13813256,1305304,3421878,11249418,10245385,5304267,5055098,128123,39090,1009358,12776911,409854,13571052,3558626,5385497,4258850,3613793,291242,11369977,11293208,14452790,239879,1980077,9350645,8809891,7727682,11562462,8639202,3939523,11259060,4428464,11732039,6511014,805422,13198602,5286073,4890637,13128924,587271,6291359,12015,12318506,5365160,6789603,3651479,86775,13835191,13011526,10789194,415872,9025881,9053781,386895,11097236,14756813,12088531,756882,135273,5582031,622327,10417890,2021104,45839,1386547,10355360];
        shuffle($uid);
        return array_slice($uid, 0, $count);
    }
}